#!/bin/sh

TEMP_FILE=$(mktemp -p ${PWD} plotter.XXXXXXXXXX) && {
    
    ./test-noisy-sinusoids ${@} > ${TEMP_FILE}
    
    gnuplot <<_EOF
set terminal jpeg
set output "${TEMP_FILE}.jpeg"
set title "Sinusoid Signals"
set zero 1e-11
set yrange [-1.2:1.2]
plot [0:511] "${TEMP_FILE}" using 1:2 title "Clean Sinusoid" lt rgb "blue" with l, "${TEMP_FILE}" using 1:3 title "Noisy Sinusoid - 0.05" lt rgb "orange" with l, "${TEMP_FILE}" using 1:4 title "Noisy Sinusoid - 0.10" lt rgb "magenta" with l
_EOF

    rm -f "${TEMP_FILE}"
}
